{"ast":null,"code":"import { makeAutoObservable } from \"mobx\";\nimport { UserService, AuthService, ChatService } from \"../services/\";\nimport axios from \"axios\";\nimport { refreshToken } from \"../routes\";\nimport ContentService from \"../services/ContentService\";\nimport ContactService from \"../services/ContactService\";\nexport default class Store {\n  constructor() {\n    this.isAuth = false;\n    this.profile = {};\n    this.chats = {};\n    this.currentDialog = {};\n    this.viewedDialogId = null;\n    this.contacts = {};\n    this.viewedUserProfile = {};\n    this.viewedUserProfileId = null;\n    this.uploadedContentForChats = {};\n    this.isLoading = false;\n    this.isError = false;\n    this.getAuth = () => {\n      return this.isAuth;\n    };\n    this.getLoading = () => {\n      return this.isLoading;\n    };\n    this.logout = () => {\n      this.removeTokensTolLocalStorage();\n      this.setAuth(false);\n      this.setProfile({});\n    };\n    makeAutoObservable(this);\n  }\n  setAuth(bool) {\n    this.isAuth = bool;\n  }\n  getProfile() {\n    return this.profile;\n  }\n  setProfile(profile) {\n    this.profile = profile;\n  }\n  getChats() {\n    return this.chats;\n  }\n  setChats(chats) {\n    this.chats = chats;\n  }\n  getCurrentDialog() {\n    return this.currentDialog;\n  }\n  setCurrentDialog(currentDialog) {\n    this.currentDialog = currentDialog;\n  }\n  getViewedDialogId() {\n    return this.viewedDialogId;\n  }\n  setViewedDialogId(viewedDialogId) {\n    this.viewedDialogId = viewedDialogId;\n  }\n  getUploadedContentForChats() {\n    return this.uploadedContentForChats;\n  }\n  setUploadedContentForChats(uploaded) {\n    this.uploadedContentForChats = uploaded;\n  }\n  getViewedUserProfile() {\n    return this.viewedUserProfile;\n  }\n  setViewedUserProfile(viewedUserProfile) {\n    this.viewedUserProfile = viewedUserProfile;\n  }\n  getViewedUserProfileId() {\n    return this.viewedUserProfileId;\n  }\n  setViewedUserProfileId(viewedUserProfileId) {\n    this.viewedUserProfileId = viewedUserProfileId;\n  }\n  getContacts() {\n    return this.contacts;\n  }\n  setContacts(contacts) {\n    this.contacts = contacts;\n  }\n  setLoading(bool) {\n    this.isLoading = bool;\n  }\n  setIsError(bool) {\n    this.isError = bool;\n  }\n  getIsError() {\n    return this.isError;\n  }\n  setTokensTolLocalStorage(response) {\n    localStorage.setItem(`${process.env.REACT_APP_NAME_TOKEN}`, response.data.token);\n    localStorage.setItem(`${process.env.REACT_APP_NAME_REFRESH_TOKEN}`, response.data.refresh_token);\n  }\n  removeTokensTolLocalStorage() {\n    localStorage.removeItem(`${process.env.REACT_APP_NAME_TOKEN}`);\n    localStorage.removeItem(`${process.env.REACT_APP_NAME_REFRESH_TOKEN}`);\n  }\n  async getProfileFromAPI() {\n    try {\n      const response = await UserService.profile();\n      this.setProfile(response.data);\n    } catch (e) {\n      this.removeTokensTolLocalStorage();\n    }\n  }\n  async signIn(request) {\n    try {\n      const response = await AuthService.signIn(request);\n      this.setTokensTolLocalStorage(response);\n      this.setAuth(true);\n      await this.getProfileFromAPI();\n    } catch (e) {\n      this.setIsError(true);\n    } finally {\n      setTimeout(() => {\n        this.setIsError(false);\n      }, 5000);\n    }\n  }\n  async signUp(request) {\n    try {\n      const response = await AuthService.signUp(request);\n      this.setTokensTolLocalStorage(response);\n      this.setAuth(true);\n      await this.getProfileFromAPI();\n    } catch (e) {\n      this.setIsError(true);\n    } finally {\n      setTimeout(() => {\n        this.setIsError(false);\n      }, 5000);\n    }\n  }\n  async forgotPassword(request) {\n    try {\n      await AuthService.forgotPassword(request);\n    } catch (e) {\n      this.setIsError(true);\n    }\n  }\n  async checkAuth() {\n    this.setLoading(true);\n    try {\n      const response = await axios.post(refreshToken(), {\n        \"refresh_token\": localStorage.getItem(`${process.env.REACT_APP_NAME_REFRESH_TOKEN}`)\n      });\n      this.setTokensTolLocalStorage(response);\n      this.setAuth(true);\n      await this.getProfileFromAPI();\n    } catch (e) {\n      this.removeTokensTolLocalStorage();\n      this.setIsError(true);\n    } finally {\n      this.setLoading(false);\n    }\n  }\n  async getChatsFromAPI() {\n    try {\n      return await ChatService.getChatsList().then(res => this.setChats(res.data));\n    } catch (e) {\n      var _e$response, _e$response$data;\n      if ((_e$response = e.response) !== null && _e$response !== void 0 && (_e$response$data = _e$response.data) !== null && _e$response$data !== void 0 && _e$response$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n  async deleteProfileFromAPI() {\n    try {\n      this.setLoading(true);\n      await UserService.deleteProfile().then(res => {\n        if (res.data.request_status) {\n          this.logout();\n        }\n      });\n    } catch (e) {\n      var _e$response2, _e$response2$data;\n      if ((_e$response2 = e.response) !== null && _e$response2 !== void 0 && (_e$response2$data = _e$response2.data) !== null && _e$response2$data !== void 0 && _e$response2$data.message) {\n        console.error(e.response.data.message);\n      }\n    } finally {\n      this.setLoading(false);\n    }\n  }\n  async updateProfileFromAPI(profileRequest) {\n    try {\n      await UserService.updateProfile(profileRequest).then(res => {\n        if (res.status === 200) {\n          this.setProfile({\n            ...this.getProfile(),\n            ...res.data\n          });\n          this.setIsError(false);\n        }\n      });\n    } catch (e) {\n      var _e$response3, _e$response3$data;\n      if ((_e$response3 = e.response) !== null && _e$response3 !== void 0 && (_e$response3$data = _e$response3.data) !== null && _e$response3$data !== void 0 && _e$response3$data.message) {\n        this.setIsError(true);\n        console.error(e.response.data.message);\n      }\n    } finally {\n      setTimeout(() => {\n        this.setIsError(false);\n      }, 5000);\n    }\n  }\n  async uploadAvatar(file) {\n    try {\n      const formData = new FormData();\n      formData.append('avatar', file);\n      await UserService.uploadAvatar(formData).then(res => {\n        if (res.status === 200) {\n          var _this$getProfile$cont;\n          const profileContents = {\n            items: ((_this$getProfile$cont = this.getProfile().content) === null || _this$getProfile$cont === void 0 ? void 0 : _this$getProfile$cont.items.slice()) || []\n          };\n\n          // @ts-ignore\n          profileContents.items.push(res.data);\n          this.setProfile({\n            ...this.getProfile(),\n            content: profileContents\n          });\n        }\n      });\n    } catch (e) {\n      var _e$response4, _e$response4$data;\n      if ((_e$response4 = e.response) !== null && _e$response4 !== void 0 && (_e$response4$data = _e$response4.data) !== null && _e$response4$data !== void 0 && _e$response4$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n  async deleteUserAvatarFromAPI(data, index) {\n    try {\n      await ContentService.deleteContent(data).then(res => {\n        var _this$getProfile$cont2;\n        if (res.status === 200 && data.id && data.avatar && (_this$getProfile$cont2 = this.getProfile().content) !== null && _this$getProfile$cont2 !== void 0 && _this$getProfile$cont2.items) {\n          var _this$getProfile$cont3;\n          const profileContents = {\n            items: ((_this$getProfile$cont3 = this.getProfile().content) === null || _this$getProfile$cont3 === void 0 ? void 0 : _this$getProfile$cont3.items.slice()) || []\n          };\n          profileContents.items.splice(index, 1);\n          this.setProfile({\n            ...this.getProfile(),\n            content: profileContents\n          });\n        }\n      });\n    } catch (e) {\n      var _e$response5, _e$response5$data;\n      if ((_e$response5 = e.response) !== null && _e$response5 !== void 0 && (_e$response5$data = _e$response5.data) !== null && _e$response5$data !== void 0 && _e$response5$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n  async deleteChatAvatarFromAPI(data, index, chatsListItem) {\n    try {\n      await ContentService.deleteContent(data).then(res => {\n        if (res.status === 200 && data.id && data.avatar) {\n          const chats = {\n            items: this.getChats().items.slice() || []\n          };\n          chats.items.forEach((chat, indexChat) => {\n            if (chatsListItem.id === chat.id) {\n              var _chats$items$indexCha;\n              (_chats$items$indexCha = chats.items[indexChat].content) === null || _chats$items$indexCha === void 0 ? void 0 : _chats$items$indexCha.items.splice(index, 1);\n            }\n          });\n          this.setChats({\n            ...this.getChats(),\n            items: chats.items\n          });\n        }\n      });\n    } catch (e) {\n      var _e$response6, _e$response6$data;\n      if ((_e$response6 = e.response) !== null && _e$response6 !== void 0 && (_e$response6$data = _e$response6.data) !== null && _e$response6$data !== void 0 && _e$response6$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n  async getContactsFromAPI() {\n    try {\n      await ContactService.getContacts().then(res => {\n        if (res.status === 200) {\n          this.setContacts({\n            ...this.getContacts(),\n            ...res.data\n          });\n        }\n      });\n    } catch (e) {\n      var _e$response7, _e$response7$data;\n      if ((_e$response7 = e.response) !== null && _e$response7 !== void 0 && (_e$response7$data = _e$response7.data) !== null && _e$response7$data !== void 0 && _e$response7$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n  async addContactFromAPI(contactId) {\n    try {\n      await ContactService.addContact(contactId).then(res => {\n        if (res.status === 200) {\n          const contactsList = {\n            items: this.getContacts().items.slice() || []\n          };\n\n          // @ts-ignore\n          contactsList.items.push(res.data);\n          this.setContacts({\n            ...this.getContacts(),\n            ...contactsList\n          });\n        }\n      });\n    } catch (e) {\n      var _e$response8, _e$response8$data;\n      if ((_e$response8 = e.response) !== null && _e$response8 !== void 0 && (_e$response8$data = _e$response8.data) !== null && _e$response8$data !== void 0 && _e$response8$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n  async acceptContactFromAPI(contact, index) {\n    try {\n      if (contact.id) {\n        await ContactService.acceptContact(contact.id).then(res => {\n          if (res.status === 200) {\n            const contactsList = {\n              items: this.getContacts().items.slice() || []\n            };\n            if (contactsList.items[index]) {\n              contactsList.items[index].status = true;\n            }\n            this.setContacts({\n              ...this.getContacts(),\n              ...contactsList\n            });\n          }\n        });\n      }\n    } catch (e) {\n      var _e$response9, _e$response9$data;\n      if ((_e$response9 = e.response) !== null && _e$response9 !== void 0 && (_e$response9$data = _e$response9.data) !== null && _e$response9$data !== void 0 && _e$response9$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n  async deleteContactFromAPI(contact, index) {\n    try {\n      if (contact.id) {\n        await ContactService.deleteContact(contact.id).then(res => {\n          if (res.status === 200) {\n            const contactsList = {\n              items: this.getContacts().items.slice() || []\n            };\n            contactsList.items.splice(index, 1);\n            this.setContacts({\n              ...this.getContacts(),\n              ...contactsList\n            });\n          }\n        });\n      }\n    } catch (e) {\n      var _e$response10, _e$response10$data;\n      if ((_e$response10 = e.response) !== null && _e$response10 !== void 0 && (_e$response10$data = _e$response10.data) !== null && _e$response10$data !== void 0 && _e$response10$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n  async getDialogOrNewFromAPI(otherUser) {\n    try {\n      let chat = {};\n      await ChatService.getDialogOrNew(otherUser.id).then(res => {\n        if (res.status === 200) {\n          const chatsList = {\n            items: this.getChats().items.slice() || []\n          };\n          let flag = false;\n          chatsList.items.forEach(item => {\n            if (item.id === res.data.id) {\n              chat = item;\n              flag = true;\n            }\n          });\n          if (!flag) {\n            // @ts-ignore\n            chatsList.items.push(res.data);\n            this.setChats({\n              ...this.getChats(),\n              ...chatsList\n            });\n            chat = res.data;\n          }\n        }\n      });\n      return chat;\n    } catch (e) {\n      var _e$response11, _e$response11$data;\n      if ((_e$response11 = e.response) !== null && _e$response11 !== void 0 && (_e$response11$data = _e$response11.data) !== null && _e$response11$data !== void 0 && _e$response11$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n  async uploadFiles(collectionFiles, chatId) {\n    let chatsWithUploaded = {};\n    let chatWithItems = {};\n    let flag = false;\n    this.setUploadedContentForChats({\n      ...this.getUploadedContentForChats(),\n      ...{\n        items: [{\n          chatId: chatId,\n          uploadedContent: this.getProfile().content || {\n            items: []\n          }\n        }]\n      }\n    });\n    chatsWithUploaded = {\n      items: this.getUploadedContentForChats().items ? this.getUploadedContentForChats().items.slice() : []\n    };\n    chatsWithUploaded.items.forEach(chat => {\n      if (chat.chatId === chatId) {\n        chatWithItems = chat;\n        flag = true;\n      }\n    });\n    if (!flag) chatWithItems = {\n      chatId: chatId,\n      uploadedContent: {}\n    };\n    console.log(chatWithItems);\n    try {\n      /*            const chatsWithUploaded: ShortChatList = {\n                      items: this.getUploadedContentForChats().items.slice() || []\n                  };\n                  let chatWithItems = {} as ShortChatsListItem;\n      \n                  this.setUploadedContentForChats({\n                      ...this.getUploadedContentForChats(),\n                      ...{\n                          items: [\n                              {\n                                  chatId: chatId,\n                                  uploadedContent: this.getProfile().content || {items: []}\n                              }\n                          ]\n                      }\n                  });\n      \n                  chatsWithUploaded.items.forEach((chat: ShortChatsListItem) => {\n                      if (chat.chatId === chatId) {\n                          chatWithItems = chat;\n                      }\n                  });\n      \n                  console.log(chatWithItems);*/\n\n      /*collectionFiles.map(async (file: File) => {\n          const formData: FormData = new FormData();\n           if (file.type.includes(\"image\")) {\n              formData.append('image', file);\n               await ContentService.uploadImage(formData).then((res) => {\n                  if (res.status === 200) {\n                      // @ts-ignore\n                      uploaded.items.push(res.data);\n                       this.setProfile({\n                          ...this.getProfile(),\n                          content: profileContents\n                      });\n                  }\n              });\n          } else {\n              formData.append('file', file);\n               await ContentService.uploadFile(formData).then((res) => {\n                  // TODO\n              });\n          }\n      });\n      console.log(this.getUploadedContentForChats());*/\n    } catch (e) {\n      var _e$response12, _e$response12$data;\n      if ((_e$response12 = e.response) !== null && _e$response12 !== void 0 && (_e$response12$data = _e$response12.data) !== null && _e$response12$data !== void 0 && _e$response12$data.message) {\n        console.error(e.response.data.message);\n      }\n    }\n  }\n}","map":{"version":3,"names":["makeAutoObservable","UserService","AuthService","ChatService","axios","refreshToken","ContentService","ContactService","Store","constructor","isAuth","profile","chats","currentDialog","viewedDialogId","contacts","viewedUserProfile","viewedUserProfileId","uploadedContentForChats","isLoading","isError","getAuth","getLoading","logout","removeTokensTolLocalStorage","setAuth","setProfile","bool","getProfile","getChats","setChats","getCurrentDialog","setCurrentDialog","getViewedDialogId","setViewedDialogId","getUploadedContentForChats","setUploadedContentForChats","uploaded","getViewedUserProfile","setViewedUserProfile","getViewedUserProfileId","setViewedUserProfileId","getContacts","setContacts","setLoading","setIsError","getIsError","setTokensTolLocalStorage","response","localStorage","setItem","process","env","REACT_APP_NAME_TOKEN","data","token","REACT_APP_NAME_REFRESH_TOKEN","refresh_token","removeItem","getProfileFromAPI","e","signIn","request","setTimeout","signUp","forgotPassword","checkAuth","post","getItem","getChatsFromAPI","getChatsList","then","res","message","console","error","deleteProfileFromAPI","deleteProfile","request_status","updateProfileFromAPI","profileRequest","updateProfile","status","uploadAvatar","file","formData","FormData","append","profileContents","items","content","slice","push","deleteUserAvatarFromAPI","index","deleteContent","id","avatar","splice","deleteChatAvatarFromAPI","chatsListItem","forEach","chat","indexChat","getContactsFromAPI","addContactFromAPI","contactId","addContact","contactsList","acceptContactFromAPI","contact","acceptContact","deleteContactFromAPI","deleteContact","getDialogOrNewFromAPI","otherUser","getDialogOrNew","chatsList","flag","item","uploadFiles","collectionFiles","chatId","chatsWithUploaded","chatWithItems","uploadedContent","log"],"sources":["/data/messenger.client/src/store/store.ts"],"sourcesContent":["import {makeAutoObservable} from \"mobx\";\nimport SignInRequest from \"../models/request/SignInRequest\";\nimport SignUpRequest from \"../models/request/SignUpRequest\";\nimport {UserService, AuthService, ChatService} from \"../services/\";\nimport {UserListItem} from \"../models/response/UserListItem\";\nimport axios, {AxiosResponse} from \"axios\";\nimport {AuthResponse} from \"../models/response/AuthResponse\";\nimport {refreshToken} from \"../routes\";\nimport ForgotPasswordRequest from \"../models/request/ForgotPasswordRequest\";\nimport {ChatsListResponse} from \"../models/response/ChatsListResponse\";\nimport {ChatsListItem} from \"../models/response/ChatsListItem\";\nimport ProfileRequest from \"../models/request/ProfileRequest\";\nimport {ContentListItem} from \"../models/response/ContentListItem\";\nimport ContentService from \"../services/ContentService\";\nimport {ContentListResponse} from \"../models/response/ContentListResponse\";\nimport {ContactListResponse} from \"../models/response/ContactListResponse\";\nimport ContactService from \"../services/ContactService\";\nimport {ContactListItem} from \"../models/response/ContactListItem\";\nimport {ShortChatList} from \"../models/uploadStoreModel/ShortChatList\";\nimport mime from \"mime\";\nimport {ShortChatsListItem} from \"../models/uploadStoreModel/ShortChatsListItem\";\n\nexport default class Store {\n    private isAuth: boolean = false;\n    public profile = {} as UserListItem;\n    public chats = {} as ChatsListResponse;\n    public currentDialog = {} as ChatsListItem;\n    public viewedDialogId: number | null = null;\n    public contacts = {} as ContactListResponse;\n    private viewedUserProfile = {} as UserListItem;\n    public viewedUserProfileId: string | null = null;\n    public uploadedContentForChats = {} as ShortChatList;\n    private isLoading: boolean = false;\n    private isError: boolean = false;\n\n    public constructor() {\n        makeAutoObservable(this);\n    }\n\n    private setAuth(bool: boolean): void {\n        this.isAuth = bool;\n    }\n\n    public getAuth: () => boolean = () => {\n        return this.isAuth;\n    }\n\n    public getProfile(): UserListItem {\n        return this.profile;\n    }\n\n    public setProfile(profile: UserListItem): void {\n        this.profile = profile;\n    }\n\n    public getChats(): ChatsListResponse {\n        return this.chats;\n    }\n\n    private setChats(chats: ChatsListResponse): void {\n        this.chats = chats;\n    }\n\n    public getCurrentDialog(): ChatsListItem {\n        return this.currentDialog;\n    }\n\n    public setCurrentDialog(currentDialog: ChatsListItem): void {\n        this.currentDialog = currentDialog;\n    }\n\n    public getViewedDialogId(): number | null {\n        return this.viewedDialogId;\n    }\n\n    public setViewedDialogId(viewedDialogId: number | null): void {\n        this.viewedDialogId = viewedDialogId;\n    }\n\n    public getUploadedContentForChats(): ShortChatList {\n        return this.uploadedContentForChats;\n    }\n\n    public setUploadedContentForChats(uploaded: ShortChatList): void {\n        this.uploadedContentForChats = uploaded;\n    }\n\n    public getViewedUserProfile(): UserListItem {\n        return this.viewedUserProfile;\n    }\n\n    public setViewedUserProfile(viewedUserProfile: UserListItem): void {\n        this.viewedUserProfile = viewedUserProfile;\n    }\n\n    public getViewedUserProfileId(): string | null {\n        return this.viewedUserProfileId;\n    }\n\n    public setViewedUserProfileId(viewedUserProfileId: string | null): void {\n        this.viewedUserProfileId = viewedUserProfileId;\n    }\n\n    public getContacts(): ContactListResponse {\n        return this.contacts;\n    }\n\n    public setContacts(contacts: ContactListResponse): void {\n        this.contacts = contacts;\n    }\n\n    private setLoading(bool: boolean): void {\n        this.isLoading = bool;\n    }\n\n    public getLoading: () => boolean = () => {\n        return this.isLoading;\n    }\n\n    public setIsError(bool: boolean): void {\n        this.isError = bool;\n    }\n\n    public getIsError(): boolean {\n        return this.isError;\n    }\n\n    public setTokensTolLocalStorage(response: AxiosResponse<AuthResponse>): void {\n        localStorage.setItem(\n            `${process.env.REACT_APP_NAME_TOKEN}`,\n            response.data.token\n        );\n        localStorage.setItem(\n            `${process.env.REACT_APP_NAME_REFRESH_TOKEN}`,\n            response.data.refresh_token\n        );\n    }\n\n    public removeTokensTolLocalStorage(): void {\n        localStorage.removeItem(`${process.env.REACT_APP_NAME_TOKEN}`);\n        localStorage.removeItem(`${process.env.REACT_APP_NAME_REFRESH_TOKEN}`);\n    }\n\n    public async getProfileFromAPI() {\n        try {\n            const response = await UserService.profile();\n            this.setProfile(response.data);\n        } catch (e) {\n            this.removeTokensTolLocalStorage();\n        }\n    }\n\n    public async signIn(request: SignInRequest) {\n        try {\n            const response = await AuthService.signIn(request);\n            this.setTokensTolLocalStorage(response);\n            this.setAuth(true);\n            await this.getProfileFromAPI();\n        } catch (e) {\n            this.setIsError(true);\n        } finally {\n            setTimeout(() => {\n                this.setIsError(false);\n            }, 5000);\n        }\n    }\n\n    public async signUp(request: SignUpRequest) {\n        try {\n            const response = await AuthService.signUp(request);\n            this.setTokensTolLocalStorage(response);\n            this.setAuth(true);\n            await this.getProfileFromAPI();\n        } catch (e) {\n            this.setIsError(true);\n        } finally {\n            setTimeout(() => {\n                this.setIsError(false);\n            }, 5000);\n        }\n    }\n\n    public async forgotPassword(request: ForgotPasswordRequest) {\n        try {\n            await AuthService.forgotPassword(request);\n        } catch (e) {\n            this.setIsError(true);\n        }\n    }\n\n     public logout = (): void => {\n        this.removeTokensTolLocalStorage();\n        this.setAuth(false);\n        this.setProfile({} as UserListItem);\n    }\n\n    public async checkAuth() {\n        this.setLoading(true);\n        try {\n            const response = await axios.post<AuthResponse>(\n                refreshToken(),\n                {\n                    \"refresh_token\": localStorage.getItem(`${process.env.REACT_APP_NAME_REFRESH_TOKEN}`)\n                }\n            );\n            this.setTokensTolLocalStorage(response);\n            this.setAuth(true);\n            await this.getProfileFromAPI();\n        } catch (e) {\n            this.removeTokensTolLocalStorage();\n            this.setIsError(true);\n        } finally {\n            this.setLoading(false);\n        }\n    }\n\n    public async getChatsFromAPI() {\n        try {\n            return await ChatService.getChatsList().then((res: any) => (\n                this.setChats(res.data)\n            ));\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n\n    public async deleteProfileFromAPI() {\n        try {\n            this.setLoading(true);\n            await UserService.deleteProfile().then((res: any) => {\n                if (res.data.request_status!) {\n                    this.logout();\n                }\n            });\n\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        } finally {\n            this.setLoading(false);\n        }\n    }\n\n    public async updateProfileFromAPI(profileRequest: ProfileRequest) {\n        try {\n            await UserService.updateProfile(profileRequest).then((res: any) => {\n                if (res.status === 200) {\n                    this.setProfile({\n                        ...this.getProfile(),\n                        ...res.data\n                    });\n                    this.setIsError(false);\n                }\n            });\n\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                this.setIsError(true);\n                console.error(e.response.data.message);\n            }\n        } finally {\n            setTimeout(() => {\n                this.setIsError(false);\n            }, 5000);\n        }\n    }\n\n    public async uploadAvatar(file: File) {\n        try {\n            const formData: FormData = new FormData();\n            formData.append('avatar', file);\n\n            await UserService.uploadAvatar(formData).then((res) => {\n                if (res.status === 200) {\n                    const profileContents: ContentListResponse = {\n                        items: this.getProfile().content?.items.slice() || []\n                    };\n\n                    // @ts-ignore\n                    profileContents.items.push(res.data);\n\n                    this.setProfile({\n                        ...this.getProfile(),\n                        content: profileContents\n                    });\n                }\n            });\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n\n    public async deleteUserAvatarFromAPI(data: ContentListItem, index: number) {\n        try {\n            await ContentService.deleteContent(data).then((res: any) => {\n                if (\n                    res.status === 200 &&\n                    data.id &&\n                    data.avatar &&\n                    this.getProfile().content?.items\n                ) {\n                    const profileContents: ContentListResponse = {\n                        items: this.getProfile().content?.items.slice() || []\n                    };\n\n                    profileContents.items.splice(index, 1);\n\n                    this.setProfile({\n                        ...this.getProfile(),\n                        content: profileContents\n                    });\n                }\n            });\n\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n\n    public async deleteChatAvatarFromAPI(data: ContentListItem, index: number, chatsListItem: ChatsListItem) {\n        try {\n            await ContentService.deleteContent(data).then((res: any) => {\n                if (res.status === 200 && data.id && data.avatar) {\n                    const chats: ChatsListResponse = {\n                        items: this.getChats().items.slice() || []\n                    };\n\n                    chats.items.forEach((chat, indexChat) => {\n                        if (chatsListItem.id === chat.id) {\n                            chats.items[indexChat].content?.items.splice(index, 1);\n                        }\n                    });\n\n                    this.setChats({\n                        ...this.getChats(),\n                        items: chats.items\n                    });\n                }\n            });\n\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n\n    public async getContactsFromAPI() {\n        try {\n            await ContactService.getContacts().then((res: any) => {\n                if (res.status === 200) {\n                    this.setContacts({\n                        ...this.getContacts(),\n                        ...res.data\n                    });\n                }\n            });\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n\n    public async addContactFromAPI(contactId: string) {\n        try {\n            await ContactService.addContact(contactId).then((res) => {\n                if (res.status === 200) {\n                    const contactsList: ContactListResponse = {\n                        items: this.getContacts().items.slice() || []\n                    };\n\n                    // @ts-ignore\n                    contactsList.items.push(res.data);\n\n                    this.setContacts({\n                        ...this.getContacts(),\n                        ...contactsList\n                    });\n                }\n            });\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n\n    public async acceptContactFromAPI(contact: ContactListItem, index: number) {\n        try {\n            if (contact.id) {\n                await ContactService.acceptContact(contact.id).then((res) => {\n                    if (res.status === 200) {\n                        const contactsList: ContactListResponse = {\n                            items: this.getContacts().items.slice() || []\n                        };\n\n                        if (contactsList.items[index]) {\n                            contactsList.items[index].status = true;\n                        }\n\n                       this.setContacts({\n                            ...this.getContacts(),\n                            ...contactsList\n                        });\n                    }\n                });\n            }\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n\n    public async deleteContactFromAPI(contact: ContactListItem, index: number) {\n        try {\n            if (contact.id) {\n                await ContactService.deleteContact(contact.id).then((res) => {\n                    if (res.status === 200) {\n                        const contactsList: ContactListResponse = {\n                            items: this.getContacts().items.slice() || []\n                        };\n\n                        contactsList.items.splice(index, 1);\n\n                        this.setContacts({\n                            ...this.getContacts(),\n                            ...contactsList\n                        });\n                    }\n                });\n            }\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n\n    public async getDialogOrNewFromAPI(otherUser: UserListItem) {\n        try {\n            let chat = {} as ChatsListItem;\n\n            await ChatService.getDialogOrNew(otherUser.id).then((res) => {\n                if (res.status === 200) {\n                    const chatsList: ChatsListResponse = {\n                        items: this.getChats().items.slice() || []\n                    };\n                    let flag: boolean = false;\n\n                    chatsList.items.forEach((item) => {\n                        if (item.id === res.data.id) {\n                            chat = item;\n                            flag = true;\n                        }\n                    });\n\n                    if (!flag) {\n                        // @ts-ignore\n                        chatsList.items.push(res.data);\n                        this.setChats({\n                            ...this.getChats(),\n                            ...chatsList\n                        });\n                        chat = res.data;\n                    }\n                }\n            });\n            return chat;\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n\n    public async uploadFiles(collectionFiles: File[], chatId: number) {\n        let chatsWithUploaded = {} as ShortChatList;\n        let chatWithItems = {} as ShortChatsListItem;\n        let flag: boolean = false;\n\n        this.setUploadedContentForChats({\n            ...this.getUploadedContentForChats(),\n            ...{\n                items: [\n                    {\n                        chatId: chatId,\n                        uploadedContent: this.getProfile().content || {items: []}\n                    }\n                ]\n            }\n        });\n\n        chatsWithUploaded = {\n            items: (this.getUploadedContentForChats().items)?\n                this.getUploadedContentForChats().items.slice():\n                []\n        };\n\n        chatsWithUploaded.items.forEach((chat: ShortChatsListItem) => {\n            if (chat.chatId === chatId) {\n                chatWithItems = chat;\n                flag = true;\n            }\n        });\n\n        if (!flag) chatWithItems = {\n            chatId: chatId,\n            uploadedContent: {} as ContentListResponse\n        };\n\n        console.log(chatWithItems);\n        try {\n/*            const chatsWithUploaded: ShortChatList = {\n                items: this.getUploadedContentForChats().items.slice() || []\n            };\n            let chatWithItems = {} as ShortChatsListItem;\n\n            this.setUploadedContentForChats({\n                ...this.getUploadedContentForChats(),\n                ...{\n                    items: [\n                        {\n                            chatId: chatId,\n                            uploadedContent: this.getProfile().content || {items: []}\n                        }\n                    ]\n                }\n            });\n\n            chatsWithUploaded.items.forEach((chat: ShortChatsListItem) => {\n                if (chat.chatId === chatId) {\n                    chatWithItems = chat;\n                }\n            });\n\n            console.log(chatWithItems);*/\n\n            /*collectionFiles.map(async (file: File) => {\n                const formData: FormData = new FormData();\n\n                if (file.type.includes(\"image\")) {\n                    formData.append('image', file);\n\n                    await ContentService.uploadImage(formData).then((res) => {\n                        if (res.status === 200) {\n                            // @ts-ignore\n                            uploaded.items.push(res.data);\n\n                            this.setProfile({\n                                ...this.getProfile(),\n                                content: profileContents\n                            });\n                        }\n                    });\n                } else {\n                    formData.append('file', file);\n\n                    await ContentService.uploadFile(formData).then((res) => {\n                        // TODO\n                    });\n                }\n            });\n            console.log(this.getUploadedContentForChats());*/\n        } catch (e: any) {\n            if (e.response?.data?.message!) {\n                console.error(e.response.data.message);\n            }\n        }\n    }\n}"],"mappings":"AAAA,SAAQA,kBAAkB,QAAO,MAAM;AAGvC,SAAQC,WAAW,EAAEC,WAAW,EAAEC,WAAW,QAAO,cAAc;AAElE,OAAOC,KAAK,MAAuB,OAAO;AAE1C,SAAQC,YAAY,QAAO,WAAW;AAMtC,OAAOC,cAAc,MAAM,4BAA4B;AAGvD,OAAOC,cAAc,MAAM,4BAA4B;AAMvD,eAAe,MAAMC,KAAK,CAAC;EAahBC,WAAW,GAAG;IAAA,KAZbC,MAAM,GAAY,KAAK;IAAA,KACxBC,OAAO,GA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